
var Message = new Class ({

	options: {
		bold:  false,
		italic:  false,
		underline: false,
		fontName: 'sans-serif',
		fontSize: '12',
		fontColor: 'black',
		type: 'msg'
	},
		
	initialize: function(sender,recip, msg, options){
		this.sender = sender;
		this.recipient = recip;
		this.content = msg;
        this.setOptions (options);
    },
    
    setOptions: function (props) {
   		this.options = props;
   	},
    
    /**
    * format the style of the message
    * @arguments
    *   isBold - (bool) is the message bolded
    *   isItalic - (bool) is the message italicized
    *   isUnderline - (bool) is the message underlined
    *   fontName - font family for the message
    *   fontSize - font size for the message
    *   fontColor - font color for the message
    *
    *  @author g. henson
    */
    
   format: function () {
        var styledMsg = "<span style=\"font-family:" + this.options.fontName + ",sans-serif;font-size:" + 
        				this.options.fontSize + "px;color:" + this.options.fontColor + ";\">" + 
        				(this.options.bold == 'true' ? "<b>" : "") + (this.options.italic == 'true' ? "<i>" : "") + 
        				(this.options.underline == 'true' ? "<u>" : "") + 
        				this.content + 
        				(this.options.bold == 'true' ? "</b>" : "") + (this.options.italic == 'true' ? "</i>" : "") + 
        				(this.options.underline == 'true' ? "</u>" : "") + 
        				"</span>";
        this.content = styledMsg;
	            
   },
   
   getSenderName: function() {
   	return this.sender.getName();
   },
   
   getRecipientName: function() {
   	return this.recipient.getName();
   },
   
   getRecipientId: function() {
   	return this.recipient.getId();
   },
   
   toString: function () {
   		return "sender : " + this.sender.toString() +
   		       ", recipient : " + this.recipient.toString() + ", body : " + this.content;
   }
   
});